#define  _CRT_SECURE_NO_WARNINGS 1

#include "string.h"

void TestString1()
{
	zzh::string s1;
	zzh::string s2("hello world");
	cout << s1.c_str() << endl;
	cout << s2.c_str() << endl;
	cout << s1.size() << endl;
	cout << s1.size() << endl;
	cout << s1.capacity() << endl;
	cout << s2.capacity() << endl;

	zzh::string s3("hello");
	s3 += ' ';
	cout << s3.c_str() << endl;
	s3 += "boys!";
	cout << s3.capacity() << endl;

	cout << s3.c_str() << endl;
	s3 += " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0";
	cout << s3.c_str() << endl;
	cout << s3.capacity() << endl;

	for (size_t i = 0; i < s2.size(); ++i)
	{
		s2[i] += 1;
		cout << s2[i] << " ";
	}
	cout << endl;
	
	zzh::string::iterator it = s2.begin();
	while (it != s2.end())
	{
		*it -= 1;
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto& ch : s2)
	{
		ch += 2;
		cout << ch << " ";
	}
	cout << endl;

	for (auto& ch : s2)
	{
		ch -= 2;
		cout << ch << " ";
	}
	cout << endl;
}

void TestString2()
{
	zzh::string s1("hello");

	cout << s1.c_str() << endl;
	s1.insert(0, ' ');
	s1.insert(0, 'k');
	cout << s1.c_str() << endl;

}

int main()
{
	TestString2();

	return 0;
}